# Contributor: Matthias Ahouansou <matthias@ahouansou.cz>
# Maintainer: Matthias Ahouansou <matthias@ahouansou.cz>
pkgname=nil
pkgver=2023.08.09
_pkgver=${pkgver//./-}
pkgrel=0
pkgdesc="An incremental analysis assistant for writing in Nix"
url="https://github.com/oxalica/nil"
arch="x86 x86_64 aarch64" # nix (aports)
license="MIT OR Apache-2.0"
makedepends="
	cargo
	cargo-auditable
	nix
"
source="
	$pkgname-$_pkgver.tar.gz::https://github.com/oxalica/nil/archive/refs/tags/$_pkgver.tar.gz
"
builddir="$srcdir/$pkgname-$_pkgver"
options="net"

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm 755 target/release/nil "$pkgdir"/usr/bin/nil

	for l in APACHE MIT
	do
		install -Dm 644 LICENSE-"$l" "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE-"$l"
	done
}

sha512sums="
44e93b06ee90503e79e41d137d14d7c576fafd889a41436aca0ddaa58eecd0cff329bd8a884baca2984a750fbb984000ef79b56981209d6692d564e0a587406c  nil-2023-08-09.tar.gz
"
